﻿<UserControl x:Class="CornerstoneRemoteControlClient.Views.TransmitSetAndRepCommandView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:views="clr-namespace:CornerstoneRemoteControlClient.Views"
             xmlns:viewModels="clr-namespace:CornerstoneRemoteControlClient.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>

        <DataTemplate DataType="{x:Type viewModels:BooleanAttributeParameter}">
            <views:BooleanAttributeParameterView/>
        </DataTemplate>
        <DataTemplate DataType="{x:Type viewModels:AttributeParameter}">
            <views:AttributeParameterView/>
        </DataTemplate>

    </UserControl.Resources>

    <Grid>
        <Rectangle StrokeThickness="0.5" Stroke="Black"/>

        <StackPanel Margin="10">

            <views:CommandNameView DataContext="{Binding}" Margin="0,0,0,5"/>

            <TextBlock Text="Parameters:" Style="{StaticResource HeaderText16}" Margin="0,15,0,0" VerticalAlignment="Center"/>

            <ItemsControl ItemsSource="{Binding Parameters.ObservableCollection}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding}" Margin="0,5"/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>

            <StackPanel Margin="0,15,0,5" Orientation="Horizontal">
                <TextBlock Text="Sets and Replicates:" Style="{StaticResource HeaderText16}" VerticalAlignment="Center"/>
                <Button Width="80" Height="20" Style="{StaticResource CircleButton}" Margin="10,0" Command="{Binding AddSetCommand}">
                    <Button.Content>
                        <TextBlock Text="+ Set" FontWeight="Bold" FontSize="14" Margin="0,-2,0,0"/>
                    </Button.Content>
                </Button>
                <Button Width="80" Height="20" Style="{StaticResource CircleButton}" Margin="10,0" Command="{Binding AddReplicateCommand}">
                    <Button.Content>
                        <TextBlock Text="+ Rep" FontWeight="Bold" FontSize="14" Margin="0,-2,0,0"/>
                    </Button.Content>
                </Button>
            </StackPanel>

            <Grid>
                <Rectangle StrokeThickness="0.5" Stroke="Black" Visibility="{Binding HasItems, Converter={StaticResource BoolToVisibility}}"/>
                <ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="200" Margin="2">
                    <ItemsControl ItemsSource="{Binding SetsAndReps.ObservableCollection}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <views:DeletableParameterView/>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                </ScrollViewer>
            </Grid>

            <views:CommandSyntaxView Margin="0,10,0,5" DataContext="{Binding}"/>
        </StackPanel>
    </Grid>
</UserControl>
